package cn.dhnep.demo.controller;

import cn.dhnep.demo.pojo.Result;
import cn.dhnep.demo.pojo.entity.SfOrder;
import cn.dhnep.demo.service.SfOrderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author 邱文彬
 * @Date 2021/11/12 9:23
 * @Version 1.0
 */


@RestController
public class SfOrderController {

    @Autowired
    private SfOrderService sfOrderService;

//    查询全部物流信息
@ApiOperation("查询全部物流信息")
    @RequestMapping(value = "/QuerySfOrder", method = RequestMethod.GET)
    public Result QuerySfOrder(@RequestParam("page") int row, @RequestParam("limit") int page) {

        List<SfOrder> sfOrder = sfOrderService.querySfOrder(row, page);
        return new Result(0, "操作成功", sfOrder);
    }

//    根据订单号查询物流信息
@ApiOperation("根据订单号查询物流信息")
@RequestMapping(value = "/selectOrderIdByOrderId", method = RequestMethod.GET)
public Result QuerySfOrderByOrderId(@RequestParam("orderId")String orderId) {

    SfOrder sfOrder = sfOrderService.querySfOrderByOrderId(orderId);
    return new Result(0, "操作成功", sfOrder);
}

//根据手机号查询物流信息
     @ApiOperation("根据手机号查询物流信息")
@RequestMapping(value = "/selectOrderIdByPhone", method = RequestMethod.GET)
public Result QuerySfOrderByPhone(@RequestParam("sendTel")String sendTel) {

    SfOrder sfOrder = sfOrderService.querySfOrderByPhone(sendTel);
    return new Result(0, "操作成功", sfOrder);
}
}
